#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long LL;
const int MAXM=30;
int n,m,mod,nxt[MAXM],ans;
char str[MAXM];
struct matrix
{
	int num[MAXM][MAXM];
	matrix()
	{
		memset(num,0,sizeof(num));
	}
	matrix operator*(const matrix b)const
	{
		matrix ret;
		for(int i=0;i<m;++i)
			for(int j=0;j<m;++j)
				for(int k=0;k<m;++k)
					ret.num[i][j]=(ret.num[i][j]+num[i][k]*b.num[k][j]%mod)%mod;
		return ret;
	}
};
int main()
{
	scanf("%d%d%d",&n,&m,&mod);
	scanf("%s",str+1);
	matrix a,b;
	b.num[0][0]=9;
	b.num[0][1]=1;
	for(int i=1;i<m;++i)
	{
		int k=nxt[i];
		while(k&&str[k+1]!=str[i+1])k=nxt[k];
		if(str[k+1]==str[i+1])nxt[i+1]=k+1;
		for(int j=0;j<=9;++j)
		{
			int t=i;
			while(t&&j+'0'!=str[t+1])t=nxt[t];
			if(str[t+1]==j+'0')++t;
			b.num[i][t]=(b.num[i][t]+1)%mod;
		}
	}
	a.num[0][0]=1;
	for(;n;n>>=1,b=b*b)
		if(n&1)a=a*b;
	for(int i=0;i<m;++i)
		ans=(ans+a.num[0][i])%mod;
	printf("%d\n",ans);
	return 0;
}
